package edu.gdkm.dao;

import edu.gdkm.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IStudentDao {
    //3、学生查看已选课接口（查看自己的已选课名称和教师名称）
    @Select("select * from t_student where sid=#{sid}")
    @Results({
            @Result(
                    column = "lid",property = "logininfo",
                    one = @One(select="edu.gdkm.dao.ILogininfoDao.queryLogininfoById")
            ),
            @Result(
                    column = "cid",
                    property = "course",
                    one = @One(select = "edu.gdkm.dao.ICourseDao.queryCourseById")
            )
    })
    public Student queryStudentById(Integer sid);
    //4、学生选课接口（可以更换已选课程）
    @Update("update t_student set name=#{name},sno=#{sno},cid=#{course.cid} where sid=#{sid}")
    public Integer updateStudent(Student student);
    @Select("select * from t_student where cid=#{cid}")
    public List<Student> queryStudentByCid(Integer cid);
}
